package com.zhangsun.system.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhangsun.base.entity.BaseEntity;
import com.zhangsun.system.enums.ResourceTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * <p>
 * 资源
 * </p>
 *
 * @author zhangsun
 * @since 2019-07-23
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("system_resource")
public class ResourceEntity extends BaseEntity<ResourceEntity> {


    /**
     * 名称
     */
    private String name;

    /**
     * 图标
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String icon;

    /**
     * 权限
     */
    private String permission;

    /**
     * 地址
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String url;

    /**
     * 上级id
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String parentId;

    /**
     * 资源类型
     */
    private ResourceTypeEnum type;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * 子菜单
     */
    @TableField(exist = false)
    private List<ResourceEntity> children;

    /**
     * 上级id集合
     */
    @TableField(exist = false)
    private List<String> parentIds;

}
